package com.itheima.jinzhi;
/*
位运算
&  遇0则0   位与
|  遇1 则1  位或
^  求异舍同(相同为0,不同为1) 位异或
~ 取反(1变0 0变1)  取反
 */
public class Demo03 {

    public static void main(String[] args) {
        System.out.println(0&1);//0
        System.out.println(1&0);//0
        System.out.println(1&1);//1
        System.out.println(0&0);//0


        System.out.println(0|1);//1
        System.out.println(1|0);//1
        System.out.println(1|1);//1
        System.out.println(0|0);//0

        System.out.println(0^1);//1
        System.out.println(1^0);//1
        System.out.println(1^1);//0
        System.out.println(0^0);//0

        System.out.println(~0);//-1
        System.out.println(~1);//-2
        System.out.println(~~1);//1


    }
}
